(0) Obligation:

Clauses:

gcd(X, Y, D) :- ','(le(X, Y), gcd_le(X, Y, D)).
gcd(X, Y, D) :- ','(gt(X, Y), gcd_le(Y, X, D)).
gcd_le(0, Y, Y).
gcd_le(s(X), Y, D) :- ','(add(s(X), Z, Y), gcd(s(X), Z, D)).
gt(s(X), s(Y)) :- gt(X, Y).
gt(s(X), 0).
le(s(X), s(Y)) :- le(X, Y).
le(0, s(Y)).
le(0, 0).
add(s(X), Y, s(Z)) :- add(X, Y, Z).
add(0, X, X).

Query: gcd(g,g,a)

(1) PrologToPiTRSProof (SOUND transformation)

We use the technique of [TOCL09]. With regard to the inferred argument filtering the predicates were used in the following modes:
gcd_in: (b,b,f)
le_in: (b,b)
gcd_le_in: (b,b,f)
add_in: (b,f,b)
gt_in: (b,b)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

gcd_in_gga(X, Y, D) → U1_gga(X, Y, D, le_in_gg(X, Y))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(X, Y, D, le_out_gg(X, Y)) → U2_gga(X, Y, D, gcd_le_in_gga(X, Y, D))
gcd_le_in_gga(0, Y, Y) → gcd_le_out_gga(0, Y, Y)
gcd_le_in_gga(s(X), Y, D) → U5_gga(X, Y, D, add_in_gag(s(X), Z, Y))
add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
add_in_gag(0, X, X) → add_out_gag(0, X, X)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U5_gga(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_gga(X, Y, D, gcd_in_gga(s(X), Z, D))
gcd_in_gga(X, Y, D) → U3_gga(X, Y, D, gt_in_gg(X, Y))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(X, Y, D, gt_out_gg(X, Y)) → U4_gga(X, Y, D, gcd_le_in_gga(Y, X, D))
U4_gga(X, Y, D, gcd_le_out_gga(Y, X, D)) → gcd_out_gga(X, Y, D)
U6_gga(X, Y, D, gcd_out_gga(s(X), Z, D)) → gcd_le_out_gga(s(X), Y, D)
U2_gga(X, Y, D, gcd_le_out_gga(X, Y, D)) → gcd_out_gga(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in_gga(x1, x2, x3)  =  gcd_in_gga(x1, x2)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x1, x2, x4)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
gcd_le_in_gga(x1, x2, x3)  =  gcd_le_in_gga(x1, x2)
gcd_le_out_gga(x1, x2, x3)  =  gcd_le_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x1, x4)
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x4)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x1, x2, x4)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
gcd_out_gga(x1, x2, x3)  =  gcd_out_gga(x3)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(2) Obligation:

Pi-finite rewrite system:
The TRS R consists of the following rules:

gcd_in_gga(X, Y, D) → U1_gga(X, Y, D, le_in_gg(X, Y))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(X, Y, D, le_out_gg(X, Y)) → U2_gga(X, Y, D, gcd_le_in_gga(X, Y, D))
gcd_le_in_gga(0, Y, Y) → gcd_le_out_gga(0, Y, Y)
gcd_le_in_gga(s(X), Y, D) → U5_gga(X, Y, D, add_in_gag(s(X), Z, Y))
add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
add_in_gag(0, X, X) → add_out_gag(0, X, X)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U5_gga(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_gga(X, Y, D, gcd_in_gga(s(X), Z, D))
gcd_in_gga(X, Y, D) → U3_gga(X, Y, D, gt_in_gg(X, Y))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(X, Y, D, gt_out_gg(X, Y)) → U4_gga(X, Y, D, gcd_le_in_gga(Y, X, D))
U4_gga(X, Y, D, gcd_le_out_gga(Y, X, D)) → gcd_out_gga(X, Y, D)
U6_gga(X, Y, D, gcd_out_gga(s(X), Z, D)) → gcd_le_out_gga(s(X), Y, D)
U2_gga(X, Y, D, gcd_le_out_gga(X, Y, D)) → gcd_out_gga(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in_gga(x1, x2, x3)  =  gcd_in_gga(x1, x2)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x1, x2, x4)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
gcd_le_in_gga(x1, x2, x3)  =  gcd_le_in_gga(x1, x2)
gcd_le_out_gga(x1, x2, x3)  =  gcd_le_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x1, x4)
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x4)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x1, x2, x4)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
gcd_out_gga(x1, x2, x3)  =  gcd_out_gga(x3)

(3) DependencyPairsProof (EQUIVALENT transformation)

Using Dependency Pairs [AG00,LOPSTR] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

GCD_IN_GGA(X, Y, D) → U1_GGA(X, Y, D, le_in_gg(X, Y))
GCD_IN_GGA(X, Y, D) → LE_IN_GG(X, Y)
LE_IN_GG(s(X), s(Y)) → U8_GG(X, Y, le_in_gg(X, Y))
LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)
U1_GGA(X, Y, D, le_out_gg(X, Y)) → U2_GGA(X, Y, D, gcd_le_in_gga(X, Y, D))
U1_GGA(X, Y, D, le_out_gg(X, Y)) → GCD_LE_IN_GGA(X, Y, D)
GCD_LE_IN_GGA(s(X), Y, D) → U5_GGA(X, Y, D, add_in_gag(s(X), Z, Y))
GCD_LE_IN_GGA(s(X), Y, D) → ADD_IN_GAG(s(X), Z, Y)
ADD_IN_GAG(s(X), Y, s(Z)) → U9_GAG(X, Y, Z, add_in_gag(X, Y, Z))
ADD_IN_GAG(s(X), Y, s(Z)) → ADD_IN_GAG(X, Y, Z)
U5_GGA(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_GGA(X, Y, D, gcd_in_gga(s(X), Z, D))
U5_GGA(X, Y, D, add_out_gag(s(X), Z, Y)) → GCD_IN_GGA(s(X), Z, D)
GCD_IN_GGA(X, Y, D) → U3_GGA(X, Y, D, gt_in_gg(X, Y))
GCD_IN_GGA(X, Y, D) → GT_IN_GG(X, Y)
GT_IN_GG(s(X), s(Y)) → U7_GG(X, Y, gt_in_gg(X, Y))
GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)
U3_GGA(X, Y, D, gt_out_gg(X, Y)) → U4_GGA(X, Y, D, gcd_le_in_gga(Y, X, D))
U3_GGA(X, Y, D, gt_out_gg(X, Y)) → GCD_LE_IN_GGA(Y, X, D)

The TRS R consists of the following rules:

gcd_in_gga(X, Y, D) → U1_gga(X, Y, D, le_in_gg(X, Y))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(X, Y, D, le_out_gg(X, Y)) → U2_gga(X, Y, D, gcd_le_in_gga(X, Y, D))
gcd_le_in_gga(0, Y, Y) → gcd_le_out_gga(0, Y, Y)
gcd_le_in_gga(s(X), Y, D) → U5_gga(X, Y, D, add_in_gag(s(X), Z, Y))
add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
add_in_gag(0, X, X) → add_out_gag(0, X, X)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U5_gga(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_gga(X, Y, D, gcd_in_gga(s(X), Z, D))
gcd_in_gga(X, Y, D) → U3_gga(X, Y, D, gt_in_gg(X, Y))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(X, Y, D, gt_out_gg(X, Y)) → U4_gga(X, Y, D, gcd_le_in_gga(Y, X, D))
U4_gga(X, Y, D, gcd_le_out_gga(Y, X, D)) → gcd_out_gga(X, Y, D)
U6_gga(X, Y, D, gcd_out_gga(s(X), Z, D)) → gcd_le_out_gga(s(X), Y, D)
U2_gga(X, Y, D, gcd_le_out_gga(X, Y, D)) → gcd_out_gga(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in_gga(x1, x2, x3)  =  gcd_in_gga(x1, x2)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x1, x2, x4)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
gcd_le_in_gga(x1, x2, x3)  =  gcd_le_in_gga(x1, x2)
gcd_le_out_gga(x1, x2, x3)  =  gcd_le_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x1, x4)
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x4)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x1, x2, x4)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
gcd_out_gga(x1, x2, x3)  =  gcd_out_gga(x3)
GCD_IN_GGA(x1, x2, x3)  =  GCD_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3, x4)  =  U1_GGA(x1, x2, x4)
LE_IN_GG(x1, x2)  =  LE_IN_GG(x1, x2)
U8_GG(x1, x2, x3)  =  U8_GG(x3)
U2_GGA(x1, x2, x3, x4)  =  U2_GGA(x4)
GCD_LE_IN_GGA(x1, x2, x3)  =  GCD_LE_IN_GGA(x1, x2)
U5_GGA(x1, x2, x3, x4)  =  U5_GGA(x1, x4)
ADD_IN_GAG(x1, x2, x3)  =  ADD_IN_GAG(x1, x3)
U9_GAG(x1, x2, x3, x4)  =  U9_GAG(x4)
U6_GGA(x1, x2, x3, x4)  =  U6_GGA(x4)
U3_GGA(x1, x2, x3, x4)  =  U3_GGA(x1, x2, x4)
GT_IN_GG(x1, x2)  =  GT_IN_GG(x1, x2)
U7_GG(x1, x2, x3)  =  U7_GG(x3)
U4_GGA(x1, x2, x3, x4)  =  U4_GGA(x4)

We have to consider all (P,R,Pi)-chains

(4) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

GCD_IN_GGA(X, Y, D) → U1_GGA(X, Y, D, le_in_gg(X, Y))
GCD_IN_GGA(X, Y, D) → LE_IN_GG(X, Y)
LE_IN_GG(s(X), s(Y)) → U8_GG(X, Y, le_in_gg(X, Y))
LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)
U1_GGA(X, Y, D, le_out_gg(X, Y)) → U2_GGA(X, Y, D, gcd_le_in_gga(X, Y, D))
U1_GGA(X, Y, D, le_out_gg(X, Y)) → GCD_LE_IN_GGA(X, Y, D)
GCD_LE_IN_GGA(s(X), Y, D) → U5_GGA(X, Y, D, add_in_gag(s(X), Z, Y))
GCD_LE_IN_GGA(s(X), Y, D) → ADD_IN_GAG(s(X), Z, Y)
ADD_IN_GAG(s(X), Y, s(Z)) → U9_GAG(X, Y, Z, add_in_gag(X, Y, Z))
ADD_IN_GAG(s(X), Y, s(Z)) → ADD_IN_GAG(X, Y, Z)
U5_GGA(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_GGA(X, Y, D, gcd_in_gga(s(X), Z, D))
U5_GGA(X, Y, D, add_out_gag(s(X), Z, Y)) → GCD_IN_GGA(s(X), Z, D)
GCD_IN_GGA(X, Y, D) → U3_GGA(X, Y, D, gt_in_gg(X, Y))
GCD_IN_GGA(X, Y, D) → GT_IN_GG(X, Y)
GT_IN_GG(s(X), s(Y)) → U7_GG(X, Y, gt_in_gg(X, Y))
GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)
U3_GGA(X, Y, D, gt_out_gg(X, Y)) → U4_GGA(X, Y, D, gcd_le_in_gga(Y, X, D))
U3_GGA(X, Y, D, gt_out_gg(X, Y)) → GCD_LE_IN_GGA(Y, X, D)

The TRS R consists of the following rules:

gcd_in_gga(X, Y, D) → U1_gga(X, Y, D, le_in_gg(X, Y))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(X, Y, D, le_out_gg(X, Y)) → U2_gga(X, Y, D, gcd_le_in_gga(X, Y, D))
gcd_le_in_gga(0, Y, Y) → gcd_le_out_gga(0, Y, Y)
gcd_le_in_gga(s(X), Y, D) → U5_gga(X, Y, D, add_in_gag(s(X), Z, Y))
add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
add_in_gag(0, X, X) → add_out_gag(0, X, X)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U5_gga(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_gga(X, Y, D, gcd_in_gga(s(X), Z, D))
gcd_in_gga(X, Y, D) → U3_gga(X, Y, D, gt_in_gg(X, Y))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(X, Y, D, gt_out_gg(X, Y)) → U4_gga(X, Y, D, gcd_le_in_gga(Y, X, D))
U4_gga(X, Y, D, gcd_le_out_gga(Y, X, D)) → gcd_out_gga(X, Y, D)
U6_gga(X, Y, D, gcd_out_gga(s(X), Z, D)) → gcd_le_out_gga(s(X), Y, D)
U2_gga(X, Y, D, gcd_le_out_gga(X, Y, D)) → gcd_out_gga(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in_gga(x1, x2, x3)  =  gcd_in_gga(x1, x2)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x1, x2, x4)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
gcd_le_in_gga(x1, x2, x3)  =  gcd_le_in_gga(x1, x2)
gcd_le_out_gga(x1, x2, x3)  =  gcd_le_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x1, x4)
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x4)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x1, x2, x4)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
gcd_out_gga(x1, x2, x3)  =  gcd_out_gga(x3)
GCD_IN_GGA(x1, x2, x3)  =  GCD_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3, x4)  =  U1_GGA(x1, x2, x4)
LE_IN_GG(x1, x2)  =  LE_IN_GG(x1, x2)
U8_GG(x1, x2, x3)  =  U8_GG(x3)
U2_GGA(x1, x2, x3, x4)  =  U2_GGA(x4)
GCD_LE_IN_GGA(x1, x2, x3)  =  GCD_LE_IN_GGA(x1, x2)
U5_GGA(x1, x2, x3, x4)  =  U5_GGA(x1, x4)
ADD_IN_GAG(x1, x2, x3)  =  ADD_IN_GAG(x1, x3)
U9_GAG(x1, x2, x3, x4)  =  U9_GAG(x4)
U6_GGA(x1, x2, x3, x4)  =  U6_GGA(x4)
U3_GGA(x1, x2, x3, x4)  =  U3_GGA(x1, x2, x4)
GT_IN_GG(x1, x2)  =  GT_IN_GG(x1, x2)
U7_GG(x1, x2, x3)  =  U7_GG(x3)
U4_GGA(x1, x2, x3, x4)  =  U4_GGA(x4)

We have to consider all (P,R,Pi)-chains

(5) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 4 SCCs with 9 less nodes.

(6) Complex Obligation (AND)

(7) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)

The TRS R consists of the following rules:

gcd_in_gga(X, Y, D) → U1_gga(X, Y, D, le_in_gg(X, Y))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(X, Y, D, le_out_gg(X, Y)) → U2_gga(X, Y, D, gcd_le_in_gga(X, Y, D))
gcd_le_in_gga(0, Y, Y) → gcd_le_out_gga(0, Y, Y)
gcd_le_in_gga(s(X), Y, D) → U5_gga(X, Y, D, add_in_gag(s(X), Z, Y))
add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
add_in_gag(0, X, X) → add_out_gag(0, X, X)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U5_gga(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_gga(X, Y, D, gcd_in_gga(s(X), Z, D))
gcd_in_gga(X, Y, D) → U3_gga(X, Y, D, gt_in_gg(X, Y))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(X, Y, D, gt_out_gg(X, Y)) → U4_gga(X, Y, D, gcd_le_in_gga(Y, X, D))
U4_gga(X, Y, D, gcd_le_out_gga(Y, X, D)) → gcd_out_gga(X, Y, D)
U6_gga(X, Y, D, gcd_out_gga(s(X), Z, D)) → gcd_le_out_gga(s(X), Y, D)
U2_gga(X, Y, D, gcd_le_out_gga(X, Y, D)) → gcd_out_gga(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in_gga(x1, x2, x3)  =  gcd_in_gga(x1, x2)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x1, x2, x4)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
gcd_le_in_gga(x1, x2, x3)  =  gcd_le_in_gga(x1, x2)
gcd_le_out_gga(x1, x2, x3)  =  gcd_le_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x1, x4)
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x4)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x1, x2, x4)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
gcd_out_gga(x1, x2, x3)  =  gcd_out_gga(x3)
GT_IN_GG(x1, x2)  =  GT_IN_GG(x1, x2)

We have to consider all (P,R,Pi)-chains

(8) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(9) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains

(10) PiDPToQDPProof (EQUIVALENT transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(11) Obligation:

Q DP problem:
The TRS P consists of the following rules:

GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(12) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • GT_IN_GG(s(X), s(Y)) → GT_IN_GG(X, Y)
    The graph contains the following edges 1 > 1, 2 > 2

(13) YES

(14) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

ADD_IN_GAG(s(X), Y, s(Z)) → ADD_IN_GAG(X, Y, Z)

The TRS R consists of the following rules:

gcd_in_gga(X, Y, D) → U1_gga(X, Y, D, le_in_gg(X, Y))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(X, Y, D, le_out_gg(X, Y)) → U2_gga(X, Y, D, gcd_le_in_gga(X, Y, D))
gcd_le_in_gga(0, Y, Y) → gcd_le_out_gga(0, Y, Y)
gcd_le_in_gga(s(X), Y, D) → U5_gga(X, Y, D, add_in_gag(s(X), Z, Y))
add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
add_in_gag(0, X, X) → add_out_gag(0, X, X)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U5_gga(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_gga(X, Y, D, gcd_in_gga(s(X), Z, D))
gcd_in_gga(X, Y, D) → U3_gga(X, Y, D, gt_in_gg(X, Y))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(X, Y, D, gt_out_gg(X, Y)) → U4_gga(X, Y, D, gcd_le_in_gga(Y, X, D))
U4_gga(X, Y, D, gcd_le_out_gga(Y, X, D)) → gcd_out_gga(X, Y, D)
U6_gga(X, Y, D, gcd_out_gga(s(X), Z, D)) → gcd_le_out_gga(s(X), Y, D)
U2_gga(X, Y, D, gcd_le_out_gga(X, Y, D)) → gcd_out_gga(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in_gga(x1, x2, x3)  =  gcd_in_gga(x1, x2)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x1, x2, x4)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
gcd_le_in_gga(x1, x2, x3)  =  gcd_le_in_gga(x1, x2)
gcd_le_out_gga(x1, x2, x3)  =  gcd_le_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x1, x4)
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x4)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x1, x2, x4)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
gcd_out_gga(x1, x2, x3)  =  gcd_out_gga(x3)
ADD_IN_GAG(x1, x2, x3)  =  ADD_IN_GAG(x1, x3)

We have to consider all (P,R,Pi)-chains

(15) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(16) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

ADD_IN_GAG(s(X), Y, s(Z)) → ADD_IN_GAG(X, Y, Z)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
ADD_IN_GAG(x1, x2, x3)  =  ADD_IN_GAG(x1, x3)

We have to consider all (P,R,Pi)-chains

(17) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(18) Obligation:

Q DP problem:
The TRS P consists of the following rules:

ADD_IN_GAG(s(X), s(Z)) → ADD_IN_GAG(X, Z)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(19) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • ADD_IN_GAG(s(X), s(Z)) → ADD_IN_GAG(X, Z)
    The graph contains the following edges 1 > 1, 2 > 2

(20) YES

(21) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)

The TRS R consists of the following rules:

gcd_in_gga(X, Y, D) → U1_gga(X, Y, D, le_in_gg(X, Y))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(X, Y, D, le_out_gg(X, Y)) → U2_gga(X, Y, D, gcd_le_in_gga(X, Y, D))
gcd_le_in_gga(0, Y, Y) → gcd_le_out_gga(0, Y, Y)
gcd_le_in_gga(s(X), Y, D) → U5_gga(X, Y, D, add_in_gag(s(X), Z, Y))
add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
add_in_gag(0, X, X) → add_out_gag(0, X, X)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U5_gga(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_gga(X, Y, D, gcd_in_gga(s(X), Z, D))
gcd_in_gga(X, Y, D) → U3_gga(X, Y, D, gt_in_gg(X, Y))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(X, Y, D, gt_out_gg(X, Y)) → U4_gga(X, Y, D, gcd_le_in_gga(Y, X, D))
U4_gga(X, Y, D, gcd_le_out_gga(Y, X, D)) → gcd_out_gga(X, Y, D)
U6_gga(X, Y, D, gcd_out_gga(s(X), Z, D)) → gcd_le_out_gga(s(X), Y, D)
U2_gga(X, Y, D, gcd_le_out_gga(X, Y, D)) → gcd_out_gga(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in_gga(x1, x2, x3)  =  gcd_in_gga(x1, x2)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x1, x2, x4)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
gcd_le_in_gga(x1, x2, x3)  =  gcd_le_in_gga(x1, x2)
gcd_le_out_gga(x1, x2, x3)  =  gcd_le_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x1, x4)
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x4)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x1, x2, x4)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
gcd_out_gga(x1, x2, x3)  =  gcd_out_gga(x3)
LE_IN_GG(x1, x2)  =  LE_IN_GG(x1, x2)

We have to consider all (P,R,Pi)-chains

(22) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(23) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)

R is empty.
Pi is empty.
We have to consider all (P,R,Pi)-chains

(24) PiDPToQDPProof (EQUIVALENT transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(25) Obligation:

Q DP problem:
The TRS P consists of the following rules:

LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(26) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • LE_IN_GG(s(X), s(Y)) → LE_IN_GG(X, Y)
    The graph contains the following edges 1 > 1, 2 > 2

(27) YES

(28) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

U1_GGA(X, Y, D, le_out_gg(X, Y)) → GCD_LE_IN_GGA(X, Y, D)
GCD_LE_IN_GGA(s(X), Y, D) → U5_GGA(X, Y, D, add_in_gag(s(X), Z, Y))
U5_GGA(X, Y, D, add_out_gag(s(X), Z, Y)) → GCD_IN_GGA(s(X), Z, D)
GCD_IN_GGA(X, Y, D) → U1_GGA(X, Y, D, le_in_gg(X, Y))
GCD_IN_GGA(X, Y, D) → U3_GGA(X, Y, D, gt_in_gg(X, Y))
U3_GGA(X, Y, D, gt_out_gg(X, Y)) → GCD_LE_IN_GGA(Y, X, D)

The TRS R consists of the following rules:

gcd_in_gga(X, Y, D) → U1_gga(X, Y, D, le_in_gg(X, Y))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U1_gga(X, Y, D, le_out_gg(X, Y)) → U2_gga(X, Y, D, gcd_le_in_gga(X, Y, D))
gcd_le_in_gga(0, Y, Y) → gcd_le_out_gga(0, Y, Y)
gcd_le_in_gga(s(X), Y, D) → U5_gga(X, Y, D, add_in_gag(s(X), Z, Y))
add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
add_in_gag(0, X, X) → add_out_gag(0, X, X)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U5_gga(X, Y, D, add_out_gag(s(X), Z, Y)) → U6_gga(X, Y, D, gcd_in_gga(s(X), Z, D))
gcd_in_gga(X, Y, D) → U3_gga(X, Y, D, gt_in_gg(X, Y))
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
U3_gga(X, Y, D, gt_out_gg(X, Y)) → U4_gga(X, Y, D, gcd_le_in_gga(Y, X, D))
U4_gga(X, Y, D, gcd_le_out_gga(Y, X, D)) → gcd_out_gga(X, Y, D)
U6_gga(X, Y, D, gcd_out_gga(s(X), Z, D)) → gcd_le_out_gga(s(X), Y, D)
U2_gga(X, Y, D, gcd_le_out_gga(X, Y, D)) → gcd_out_gga(X, Y, D)

The argument filtering Pi contains the following mapping:
gcd_in_gga(x1, x2, x3)  =  gcd_in_gga(x1, x2)
U1_gga(x1, x2, x3, x4)  =  U1_gga(x1, x2, x4)
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
U2_gga(x1, x2, x3, x4)  =  U2_gga(x4)
gcd_le_in_gga(x1, x2, x3)  =  gcd_le_in_gga(x1, x2)
gcd_le_out_gga(x1, x2, x3)  =  gcd_le_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x1, x4)
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
U6_gga(x1, x2, x3, x4)  =  U6_gga(x4)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x1, x2, x4)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
gcd_out_gga(x1, x2, x3)  =  gcd_out_gga(x3)
GCD_IN_GGA(x1, x2, x3)  =  GCD_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3, x4)  =  U1_GGA(x1, x2, x4)
GCD_LE_IN_GGA(x1, x2, x3)  =  GCD_LE_IN_GGA(x1, x2)
U5_GGA(x1, x2, x3, x4)  =  U5_GGA(x1, x4)
U3_GGA(x1, x2, x3, x4)  =  U3_GGA(x1, x2, x4)

We have to consider all (P,R,Pi)-chains

(29) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(30) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

U1_GGA(X, Y, D, le_out_gg(X, Y)) → GCD_LE_IN_GGA(X, Y, D)
GCD_LE_IN_GGA(s(X), Y, D) → U5_GGA(X, Y, D, add_in_gag(s(X), Z, Y))
U5_GGA(X, Y, D, add_out_gag(s(X), Z, Y)) → GCD_IN_GGA(s(X), Z, D)
GCD_IN_GGA(X, Y, D) → U1_GGA(X, Y, D, le_in_gg(X, Y))
GCD_IN_GGA(X, Y, D) → U3_GGA(X, Y, D, gt_in_gg(X, Y))
U3_GGA(X, Y, D, gt_out_gg(X, Y)) → GCD_LE_IN_GGA(Y, X, D)

The TRS R consists of the following rules:

add_in_gag(s(X), Y, s(Z)) → U9_gag(X, Y, Z, add_in_gag(X, Y, Z))
le_in_gg(s(X), s(Y)) → U8_gg(X, Y, le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg(0, s(Y))
le_in_gg(0, 0) → le_out_gg(0, 0)
gt_in_gg(s(X), s(Y)) → U7_gg(X, Y, gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg(s(X), 0)
U9_gag(X, Y, Z, add_out_gag(X, Y, Z)) → add_out_gag(s(X), Y, s(Z))
U8_gg(X, Y, le_out_gg(X, Y)) → le_out_gg(s(X), s(Y))
U7_gg(X, Y, gt_out_gg(X, Y)) → gt_out_gg(s(X), s(Y))
add_in_gag(0, X, X) → add_out_gag(0, X, X)

The argument filtering Pi contains the following mapping:
le_in_gg(x1, x2)  =  le_in_gg(x1, x2)
s(x1)  =  s(x1)
U8_gg(x1, x2, x3)  =  U8_gg(x3)
0  =  0
le_out_gg(x1, x2)  =  le_out_gg
add_in_gag(x1, x2, x3)  =  add_in_gag(x1, x3)
U9_gag(x1, x2, x3, x4)  =  U9_gag(x4)
add_out_gag(x1, x2, x3)  =  add_out_gag(x2)
gt_in_gg(x1, x2)  =  gt_in_gg(x1, x2)
U7_gg(x1, x2, x3)  =  U7_gg(x3)
gt_out_gg(x1, x2)  =  gt_out_gg
GCD_IN_GGA(x1, x2, x3)  =  GCD_IN_GGA(x1, x2)
U1_GGA(x1, x2, x3, x4)  =  U1_GGA(x1, x2, x4)
GCD_LE_IN_GGA(x1, x2, x3)  =  GCD_LE_IN_GGA(x1, x2)
U5_GGA(x1, x2, x3, x4)  =  U5_GGA(x1, x4)
U3_GGA(x1, x2, x3, x4)  =  U3_GGA(x1, x2, x4)

We have to consider all (P,R,Pi)-chains

(31) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(32) Obligation:

Q DP problem:
The TRS P consists of the following rules:

U1_GGA(X, Y, le_out_gg) → GCD_LE_IN_GGA(X, Y)
GCD_LE_IN_GGA(s(X), Y) → U5_GGA(X, add_in_gag(s(X), Y))
U5_GGA(X, add_out_gag(Z)) → GCD_IN_GGA(s(X), Z)
GCD_IN_GGA(X, Y) → U1_GGA(X, Y, le_in_gg(X, Y))
GCD_IN_GGA(X, Y) → U3_GGA(X, Y, gt_in_gg(X, Y))
U3_GGA(X, Y, gt_out_gg) → GCD_LE_IN_GGA(Y, X)

The TRS R consists of the following rules:

add_in_gag(s(X), s(Z)) → U9_gag(add_in_gag(X, Z))
le_in_gg(s(X), s(Y)) → U8_gg(le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg
le_in_gg(0, 0) → le_out_gg
gt_in_gg(s(X), s(Y)) → U7_gg(gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg
U9_gag(add_out_gag(Y)) → add_out_gag(Y)
U8_gg(le_out_gg) → le_out_gg
U7_gg(gt_out_gg) → gt_out_gg
add_in_gag(0, X) → add_out_gag(X)

The set Q consists of the following terms:

add_in_gag(x0, x1)
le_in_gg(x0, x1)
gt_in_gg(x0, x1)
U9_gag(x0)
U8_gg(x0)
U7_gg(x0)

We have to consider all (P,Q,R)-chains.

(33) QDPQMonotonicMRRProof (EQUIVALENT transformation)

By using the Q-monotonic rule removal processor with the following ordering, at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented such that it always occurs at a strongly monotonic position in a (P,Q,R)-chain.

Strictly oriented rules of the TRS R:

U9_gag(add_out_gag(Y)) → add_out_gag(Y)

Used ordering: Polynomial interpretation [POLO]:

POL(0) = 0   
POL(GCD_IN_GGA(x1, x2)) = 1 + x1 + x2   
POL(GCD_LE_IN_GGA(x1, x2)) = 1 + x1 + x2   
POL(U1_GGA(x1, x2, x3)) = 1 + x1 + x2   
POL(U3_GGA(x1, x2, x3)) = 1 + x1 + x2   
POL(U5_GGA(x1, x2)) = x1 + x2   
POL(U7_gg(x1)) = 0   
POL(U8_gg(x1)) = 0   
POL(U9_gag(x1)) = 1 + x1   
POL(add_in_gag(x1, x2)) = 2 + x2   
POL(add_out_gag(x1)) = 2 + x1   
POL(gt_in_gg(x1, x2)) = 0   
POL(gt_out_gg) = 0   
POL(le_in_gg(x1, x2)) = 0   
POL(le_out_gg) = 0   
POL(s(x1)) = 1 + x1   

(34) Obligation:

Q DP problem:
The TRS P consists of the following rules:

U1_GGA(X, Y, le_out_gg) → GCD_LE_IN_GGA(X, Y)
GCD_LE_IN_GGA(s(X), Y) → U5_GGA(X, add_in_gag(s(X), Y))
U5_GGA(X, add_out_gag(Z)) → GCD_IN_GGA(s(X), Z)
GCD_IN_GGA(X, Y) → U1_GGA(X, Y, le_in_gg(X, Y))
GCD_IN_GGA(X, Y) → U3_GGA(X, Y, gt_in_gg(X, Y))
U3_GGA(X, Y, gt_out_gg) → GCD_LE_IN_GGA(Y, X)

The TRS R consists of the following rules:

add_in_gag(s(X), s(Z)) → U9_gag(add_in_gag(X, Z))
le_in_gg(s(X), s(Y)) → U8_gg(le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg
le_in_gg(0, 0) → le_out_gg
gt_in_gg(s(X), s(Y)) → U7_gg(gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg
U8_gg(le_out_gg) → le_out_gg
U7_gg(gt_out_gg) → gt_out_gg
add_in_gag(0, X) → add_out_gag(X)

The set Q consists of the following terms:

add_in_gag(x0, x1)
le_in_gg(x0, x1)
gt_in_gg(x0, x1)
U9_gag(x0)
U8_gg(x0)
U7_gg(x0)

We have to consider all (P,Q,R)-chains.

(35) Narrowing (SOUND transformation)

By narrowing [LPAR04] the rule GCD_LE_IN_GGA(s(X), Y) → U5_GGA(X, add_in_gag(s(X), Y)) at position [1] we obtained the following new rules [LPAR04]:

GCD_LE_IN_GGA(s(x0), s(x1)) → U5_GGA(x0, U9_gag(add_in_gag(x0, x1)))

(36) Obligation:

Q DP problem:
The TRS P consists of the following rules:

U1_GGA(X, Y, le_out_gg) → GCD_LE_IN_GGA(X, Y)
U5_GGA(X, add_out_gag(Z)) → GCD_IN_GGA(s(X), Z)
GCD_IN_GGA(X, Y) → U1_GGA(X, Y, le_in_gg(X, Y))
GCD_IN_GGA(X, Y) → U3_GGA(X, Y, gt_in_gg(X, Y))
U3_GGA(X, Y, gt_out_gg) → GCD_LE_IN_GGA(Y, X)
GCD_LE_IN_GGA(s(x0), s(x1)) → U5_GGA(x0, U9_gag(add_in_gag(x0, x1)))

The TRS R consists of the following rules:

add_in_gag(s(X), s(Z)) → U9_gag(add_in_gag(X, Z))
le_in_gg(s(X), s(Y)) → U8_gg(le_in_gg(X, Y))
le_in_gg(0, s(Y)) → le_out_gg
le_in_gg(0, 0) → le_out_gg
gt_in_gg(s(X), s(Y)) → U7_gg(gt_in_gg(X, Y))
gt_in_gg(s(X), 0) → gt_out_gg
U8_gg(le_out_gg) → le_out_gg
U7_gg(gt_out_gg) → gt_out_gg
add_in_gag(0, X) → add_out_gag(X)

The set Q consists of the following terms:

add_in_gag(x0, x1)
le_in_gg(x0, x1)
gt_in_gg(x0, x1)
U9_gag(x0)
U8_gg(x0)
U7_gg(x0)

We have to consider all (P,Q,R)-chains.

(37) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 0 SCCs with 6 less nodes.

(38) TRUE